'''only support for english sentences, because I can't find chinese ASTE dataset.'''
from fire import Fire
from core.runner.runner import BaseRunner
import core.utils.logging as logging



def main(*args, **kwargs):
    kwargs = parse_args(kwargs)
    logging.info(f'args:{kwargs}')
    runner = BaseRunner(*args, **kwargs)
    runner.run()

def parse_args(kwargs):
    new_kwargs = dict()
    for key in kwargs.keys():
        if '.' in key:
            temp = key.split('.')
            temp_dict = temp[0]
            temp_key = temp[1]
            if temp_dict in new_kwargs.keys():
                new_kwargs[temp_dict][temp_key] = kwargs[key]
            else:
                new_kwargs[temp_dict] = dict()
                new_kwargs[temp_dict][temp_key] = kwargs[key]
        else:
            new_kwargs[key] = kwargs[key]
    return new_kwargs
    

if __name__ == '__main__':
    Fire(main)